package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.*;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 护理等级 与 自理能力
 */
@Entity
@Table(name = "tnb_nursinglevel_carelevel")
@JsonApiResource(type = "nursinglevelcarelevel")
public class NursinglevelCarelevel extends BaseEntity {
	private NursingLevel nursingLevel;// 老人

	private Dicttype selfCareLevel;// 自理能力

	private String remark;// 备注

	@JsonApiToOne
	// @JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "nursinglevel_id", foreignKey = @ForeignKey(name = "null"))
	public NursingLevel getNursingLevel() {
		return nursingLevel;
	}

	public void setNursingLevel(NursingLevel nursingLevel) {
		this.nursingLevel = nursingLevel;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "carelevel_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getSelfCareLevel() {
		return selfCareLevel;
	}

	public void setSelfCareLevel(Dicttype selfCareLevel) {
		this.selfCareLevel = selfCareLevel;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}